package cn.hy.dubbo;

import cn.hy.dubbo.limiter.TokenBasedLimitStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

import javax.annotation.Resource;

/**
 * @author zhaomu
 */
@Configuration
public class DubboLimitAutoConfig {

    @Resource
    LimitConf limitConf;

    @Bean
    public TokenBasedLimitStrategy tokenBasedLimitStrategy(StringRedisTemplate stringRedisTemplate) {
        return new TokenBasedLimitStrategy(stringRedisTemplate,limitConf);
    }
}
